<script setup lang="ts">
import BaseEchart from '@/base-ui/echarts/BaseEchart.vue'
import type { IPieEchartData } from '../types'

const props = defineProps<{ roseData: IPieEchartData[] }>()
// console.log(props.roseData)

const options: any = computed(() => {
  return {
    // legend: {},
    toolbox: {
      show: true,
      feature: {
        mark: { show: true },
        dataView: { show: true, readOnly: false },
        restore: { show: true },
        saveAsImage: { show: true }
      }
    },
    tooltip: { trigger: 'item' },
    series: [
      {
        name: '访问来源',
        type: 'pie',
        radius: [15, 120],
        center: ['50%', '50%'],
        roseType: 'area',
        itemStyle: {
          borderRadius: 8
        },
        data: props.roseData,
        label: {
          show: false
        }
      }
    ]
  }
})
</script>

<template>
  <div class="rose-echart">
    <BaseEchart :options="options"></BaseEchart>
  </div>
</template>

<style scoped></style>
